package com.xwaiy.xwaiyrpc.registry;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 本地注册中心
 * @Author Xwaiy
 * @Date 2025/8/20 17:59
 **/
public class LocalRegistry {
    /**
     * 注册信息存储
     */
    private static final Map<String, Object> map = new ConcurrentHashMap<>();

    /**
     * 注册服务
     *
     * @param serviceName
     * @param serviceImpl
     */
    public static void registerService(String serviceName, Object serviceImpl) {
        map.put(serviceName, serviceImpl);
    }

    /**
     * 获取服务
     *
     * @param serviceName
     * @return
     */
    public static Object getService(String serviceName) {
        return map.get(serviceName);
    }

    /**
     * 删除服务
     *
     * @param serviceName
     */
    public static void removeService(String serviceName) {
        map.remove(serviceName);
    }
}
